import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace VenueTypeApi {
  /** 阵地类型信息 */
  export interface VenueType {
    id?: number;
    // TODO: 添加字段
  }

  /** 阵地类型分页查询参数 */
  export interface VenueTypePageReqVO extends PageParam {
    createTime?: string[];
    // TODO: 添加查询条件字段
  }
}

/** 查询阵地类型分页 */
export function getVenueTypePage(params: VenueTypeApi.VenueTypePageReqVO) {
  return requestClient.get<PageResult<VenueTypeApi.VenueType>>(
    '/cmt/venue-type/page',
    { params },
  );
}

/** 查询阵地类型详情 */
export function getVenueType(id: number) {
  return requestClient.get<VenueTypeApi.VenueType>(
    `/cmt/venue-type/get?id=${id}`,
  );
}

/** 新增阵地类型 */
export function createVenueType(data: VenueTypeApi.VenueType) {
  return requestClient.post('/cmt/venue-type/create', data);
}

/** 修改阵地类型 */
export function updateVenueType(data: VenueTypeApi.VenueType) {
  return requestClient.put('/cmt/venue-type/update', data);
}

/** 删除阵地类型 */
export function deleteVenueType(id: number) {
  return requestClient.delete(`/cmt/venue-type/delete?id=${id}`);
}

/** 批量删除阵地类型 */
export function deleteVenueTypeList(ids: number[]) {
  return requestClient.delete(
    `/cmt/venue-type/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出阵地类型 */
export function exportVenueType(params: any) {
  return requestClient.download('/cmt/venue-type/export-excel', { params });
}

/** 获取阵地类型选项列表(用于下拉选择) */
export function getVenueTypeOptions() {
  return requestClient.get<PageResult<VenueTypeApi.VenueType>>(
    '/cmt/venue-type/page',
    { params: { pageNo: -1, pageSize: 10 } },
  );
}
